package com.linsir.controller;

import com.linsir.lin.service.AccountService;
import com.linsir.lin.service.CamundaService;
import com.linsir.service.ModelService;
import freemarker.template.Configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;


/**
 * @Auther: yuxiaolin
 * @Date: 2021/5/26 17:16
 * @Description:
 */
@RestController
@RequestMapping(value = "/")
public class IndexController {

    @Autowired
    private ModelService modelService;

    @Autowired
    private AccountService accountService;

    @Resource
    private FreeMarkerConfigurer freeMarkerConfigurer;

    @Resource
    private CamundaService camundaService;

    public IndexController() {
    }

    @RequestMapping(value = "")
    public String Index() throws IOException {
       // Map<String,String> map =new HashMap<String,String>();
        //map.put("hi","holll");
        //map.put("aaa","xxxx");
        //modelService.createTable("test");
        //return map;
        Configuration configuration = freeMarkerConfigurer.getConfiguration();

        String a = configuration.getTemplate("info.ftl").toString();
        System.out.println(a);

        List list =new ArrayList();
        list=modelService.selectModel("test");
        camundaService.get();
        return a;
    }

    @RequestMapping(value = "home",method = {RequestMethod.GET})
    public String Home()
    {
        return "Home";
    }
}
